import axios from 'axios'

import {Toast} from 'antd-mobile'

axios.interceptors.request.use(function (config) {
    // Do something before request is sent
    setTimeout(()=>{
      Toast.loading('加载中...', 0.5, () => { //在请求到数据前显示loading正在加载
        console.log('Load complete !!!');
      });
    },300)
    
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });
 
// Add a response interceptor 数据请求后
axios.interceptors.response.use(function (response) {
    // Do something with response data
    Toast.hide()
    return response;
  }, function (error) {
    // Do something with response error
    return Promise.reject(error);
  });
